package cn.javass.dp.iterator.example6;

import java.util.Iterator;
import java.util.function.Consumer;

public class ArrayIteratorImpl implements Iterator {

    private PayModel[] pms = null;

    private int index = 0;

    public  ArrayIteratorImpl(SalaryManager salaryManager) {
        //在这里进行工资必行在3000以下的过滤
        this.pms = salaryManager.getPms();
    }

    @Override
    public boolean hasNext() {
        if (index < pms.length) {
            return true;
        }
        return false;
    }

    @Override
    public Object next() {
        //在这里过滤权限的
        Object obj = null;
        if (index < pms.length) {
            obj = pms[index];
            index++;
        }
        return obj;
    }

    @Override
    public void remove() {

    }

    @Override
    public void forEachRemaining(Consumer action) {
    }
}
